function ListNode(x){
    this.val = x;
    this.next = null;
}
function Merge(pHead1, pHead2)
{
    // write code here
    if(pHead1 === null) return pHead2
    if(pHead2 === null) return pHead1
    var head = new ListNode(0)
    var cur = head 
    while(pHead1 && pHead2){
      if(pHead1.val < pHead2.val){
        cur.next = pHead1
        pHead1 = pHead1.next
      }else{
        cur.next = pHead2
        pHead2 = pHead2.next
      }
      cur = cur.next
    }
    
    cur.next = pHead1 === null ? pHead2 : pHead1
    return head.next
}
module.exports = {
    Merge : Merge
};